package top.heue.epro.util;

import java.io.*;

public class FileIOUtil {
	public static String read(String pathname) {
        String line2 = "";
        try {
            try (FileReader reader = new FileReader(pathname);
            BufferedReader br = new BufferedReader(reader)
            ) {
                String line;
                while ((line = br.readLine()) != null) {
                    line2 += line;
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            return line2;
        }
	}

	public static Boolean write(String dir, String info) {
        try {
            File file = new File(dir);
            if(!file.exists()) file.createNewFile();
            FileWriter fw=new FileWriter(file);
            fw.write(info);
            fw.close();
        } catch (IOException e) {
            e.printStackTrace();
            return false;
        } finally {
            return true;
        }
	}


}
